# ###############################################
# Check for a valid version of CMake.
CMAKE_MINIMUM_REQUIRED( VERSION 2.8.11 )


# ###############################################
# Start the project.
PROJECT( Game C CXX )


# ###############################################
INCLUDE( CMake/Setup.cmake )


# ###############################################
# Include some utilities.
INCLUDE( CMake/OS.cmake )
INCLUDE( CMake/Compilers.cmake )
INCLUDE( CMake/Options.cmake )
INCLUDE( CMake/SetupMsvcIntel.cmake )
INCLUDE( CMake/SetupGnuClang.cmake )


# ###############################################
# Generate the configuration file based on the
# options provided.
CONFIGURE_FILE( ${CMAKE_CURRENT_LIST_DIR}/Config.hpp.in ${CMAKE_CURRENT_LIST_DIR}/Libraries/Core/Include/Core/Config.hpp )


# ###############################################
# Find the threading package for this machine.
FIND_PACKAGE( Threads )


# ###############################################
# For windows, need to point towards the SFML supplied OpenAL.
IF( WIN32 )
	IF( SIZEOF_VOID_P EQUAL "4" )
		SET( OPENAL_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/External/SFML-2.0/extlibs/headers/AL )
		SET( OPENAL_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/External/SFML-2.0/extlibs/libs-msvc/x86/openal32.lib )
	ELSE()
		SET( OPENAL_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/External/SFML-2.0/extlibs/headers/AL )
		SET( OPENAL_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/External/SFML-2.0/extlibs/libs-msvc/x64/openal32.lib )
	ENDIF()
ELSE()
	FIND_PACKAGE( OpenAL REQUIRED )
ENDIF()


# ###############################################
FIND_PACKAGE( OpenGL REQUIRED )


# ###############################################
# Add the external libraries, internal libraries,
# applications and tools to the project.
ADD_SUBDIRECTORY( External )
ADD_SUBDIRECTORY( Libraries )
ADD_SUBDIRECTORY( Applications )
ADD_SUBDIRECTORY( Tools )
